<?php

namespace App\Http\Requests\Back;

use Illuminate\Foundation\Http\FormRequest;

class ModuleRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name'=>'required|unique:modules',
            'list'=>'required',
            'article'=>'required',
            'cover'=>'required',
        ];
    }

    /**
     * @return array
     */
    public function messages()
    {
        return [
            'name.required'=>'名称不能为空',
            'name.unique'=>'该名称已存在',
            'list.required'=>'列表模板不能为空',
            'article.required'=>'文章模板不能为空',
            'cover.required'=>'封面模板不能为空',
        ]; // TODO: Change the autogenerated stub
    }
}
